﻿module DevelopmentWork
open System
type StaffName={Nick:string;Full:string}
type Worker={Name:StaffName}
type Work={Title:string;Description:string;ExpectStartOn:DateTime;ExpectFinishedOn:DateTime;AssignedTo:Worker option;SubWorks:seq<Work>}
module Workers=
    let worker nick={Name={Nick=nick;Full=""}}
    let fullNames fullName worker={worker with Name={worker.Name with Full=fullName}}
    let w,f=worker,fullNames
module DateTime=
    let month month=
        let year=DateTime.Now.Year
        DateTime(year,month,1),DateTime(year,month,DateTime.DaysInMonth(year,month))
module Works=
    let work title (expectStartOn,expectFinishedOn)={Title=title;Description="";ExpectStartOn=expectStartOn;ExpectFinishedOn=expectFinishedOn;AssignedTo=None;SubWorks=Seq.empty}
    let descript description work={work with Description=description}
    let assign worker work={work with AssignedTo=Some worker}
    let subWorks works work={work with SubWorks=works}
    let w,d,s,a=work,descript,subWorks,assign
module Zhongtie=
    module Workers=
        open Workers
        let yi,wx,zp,zl,yy,yw=w"Yi"|>f"衣恩德",w"王旭",w"张鹏",w"仝泽龙",w"杨勇",w"李彦武"
        let all=[yi;wx;zp;zl;yy;yw]
    module Works=
        open Workers
        open Works
        open DateTime
        let dailyCashingRepot=w"资金日报"(DateTime.month 3)|>a yi
        let oa=w"协作平台（OA）"(month 3)|>a yi|>s[w"框架"(month 3)|>a yw;w"公告"(month 3)|>a zp;w"公文"(month 3)|>a zp]
        let all=[dailyCashingRepot;oa]
    module WebsiteAgent=
        let works()=seq Works.all